package com.ctshk.rpc.scenic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.scenic.entity.ScenicProductChannelOffline;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author xuhui
 * @since 2/4/2021
 */
public interface ScenicProductChannelOfflineMapper extends BaseMapper<ScenicProductChannelOffline> {

    /**
     * 清空门票产品线下渠道权限范围表
     * @param
     * @param
     */
    @Update("UPDATE t_scenic_product_channel_offline \n" +
            "SET is_deleted = 1,modified_id = #{modified_id}\n" +
            "WHERE product_id = #{product_id}")
    Integer clearByProductId(@Param("product_id") Long productId, @Param("modified_id")Long userId);

    @Select("select" +
            " channel_type channelType, product_id productId" +
            " from t_scenic_product_channel_offline" +
            " where is_deleted = 0 and product_id = #{productId}")
    List<ScenicProductChannelOffline> selectChannelTypeListByProductId(@Param("productId") Long productId);

    @Select("select *" +
            " from t_scenic_product_channel_offline" +
            " where  product_id = #{productId}")
    List<ScenicProductChannelOffline> selectChannelListByProductId(@Param("productId") Long productId);
}
